package com.zbzly.cloud.appconsul.controller;

import com.zbzly.cloud.appconsul.config.UserConfiguration;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
public class ConfigController {
    @Resource
    private UserConfiguration userConfiguration;
    @Value("${consul}")
    public String consul;

    @GetMapping("/consul")
    public String getConsul() {
        return consul;
    }

    @GetMapping("/user")
    public String info() {
        return userConfiguration.name;
    }
}
